package cn.icanci.slf4j.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: icanci
 * @ProjectName: Spring-Boot-Cases
 * @PackageName: cn.icanci.slf4j
 * @Date: Created in 2020/7/18 13:07
 * @ClassAction: Slf4jController 测试 Slf4j
 */
@RestController
@RequestMapping("/test")
public class Slf4jController {
    private final static Logger logger = LoggerFactory.getLogger(Slf4jController.class);

    @RequestMapping("/log")
    public String testLog() {
        logger.debug("=====测试日志debug级别打印====");
        logger.info("======测试日志info级别打印=====");
        logger.error("=====测试日志error级别打印====");
        logger.warn("======测试日志warn级别打印=====");

        // 可以使用占位符打印出一些参数信息
        String str1 = "icanci";
        String str2 = "hashmap";
        logger.info("======我的名字：{}；我的属性：{}", str1, str2);

        return "success";
    }
}